<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>SSE Demo</title>
    <script>
       var source = new EventSource("http://localhost:8080/sse/subscribe?id=sse1")
       source.onmessage = function (event) {
           text = document.getElementById("result").innerText;
           text += "\n" + event.data;
           document.getElementById("result").innerText = text;
       };

       source.onopen = function (event) {
           text = document.getElementById("result").innerText;
           text += "\n 开启：";
           console.log(event);
           document.getElementById("result").innerText = text;
       };
    </script>
</head>
<body>
    <div id="result"></div>
</body>
</html>